<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增施工安装合同')" />
    <th:block th:include="include :: jasny-bootstrap-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-sgazht-add">
        	<input type="hidden" name="gcProjectid" id="gcProjectid" th:value="${gcProjectid}"/>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">项目编号：</label>
                <div class="col-sm-8">
                    <input name="orderNo" class="form-control" type="text" autoComplete="off" readonly="readonly" th:value="${orderNo}" required>
                </div>
            </div>
            <div class="form-group">
           		<label class="col-sm-3 control-label">合同文件：</label>
               	<div class="fileinput fileinput-new" data-provides="fileinput">
                   <span class="btn btn-white btn-file">
                   	<span class="fileinput-new">选择文件</span>
                   	<span class="fileinput-exists">更改</span>
                   	<input type="file" name="zilwjfile" id="zilwjfile">
                   </span>
                   <span class="fileinput-filename"></span>
                   <a href="#" class="close fileinput-exists" data-dismiss="fileinput" style="float: none">&times;</a>
            	</div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/sgazht"
        $("#form-sgazht-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
            	
            	var form = document.getElementById("form-sgazht-add");
                var file = new FormData(form);
                $.ajax({
                    url: "/gcgl/sgazhtjgzl/addYs",
                    type: "POST",
                    processData:false,
                    contentType:false,
                    //重要部分，data的传的是整个表单，不用大括号包裹；不用自定义变量名
                    data:file,
                    success: function (date) {
                    	$.operate.ajaxSuccess(date);
                    	$.modal.close();
                    },
                    error: function (date) {
                    	$.operate.ajaxSuccess(date);
                    	$.modal.close();
                    }
                })
            	
                //$.operate.save(prefix + "/add", $('#form-sgazht-add').serialize());
            }
        }

    </script>
</body>
</html>